<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/resource/common.jsp"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<%--系统访问日志管理 --%>
	<title>${title}</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<script type="text/javascript">
		//分页
		function _goto(){
			$('#test').datagrid('load',{
			
				userid:$('#userid').val(),
				uname:$('#uname').val(),
				logintime1:$('#logintime1').val(),
				logintime2:$('#logintime2').val()
			});
		}
		
		$(function(){
			//界面初始化
			//界面初始化
			$("#div_nav,#query_form").css({"width":$(window).width()});
			$("#tbl_datalist tr:even").css({
				"background-color" : "#f3fbfe"
			});
			var _tmp_bg = "#fff";
			$("#tbl_datalist tr").hover(function() {
				_tmp_bg = $(this).css("background-color");
				$(this).css("background-color", "#cce3c7");
			}, function() {
				$(this).css("background-color", _tmp_bg);
			});
			var _tbl_h = $(window).height() - 90;
			if ($.browser.msie && ($.browser.version == "6.0")) {
				_tbl_h -= 10;
			}
			$("#tbl_container").css({
				"height" : _tbl_h
			});
			$("#btn_log_search").click(function(){
				var bool =false;
				var logintime1 = $("#logintime1").val().replace(/(^\s*)|(\s*$)/g,'');
				var logintime2 = $("#logintime2").val().replace(/(^\s*)|(\s*$)/g,'');
				if(("" != logintime1 && "" == logintime2) || (""!=logintime2 && ""==logintime1)){
					art.dialog.tips("操作时间必须是一个时间段！！请重新选择！");
					return false;
				}else{
					var url = "<c:url value='/sso/query/1.html'/>";
					$("#query_form").attr("action",url);
					$("#query_form").submit();
				}
			});
			
			
			$('#test').datagrid({
				//title:'My DataGrid',
				iconCls:'icon-save',
				width:$(window).width(),
				height:$(window).height()-42,
				nowrap: true,
				//autoRowHeight: false,
				striped: true,
				//collapsible:true,
				url:'<%=path%>/sso/query/list.json',
				//sortName: 'code',
				//sortOrder: 'desc',
				//remoteSort: false,
				singleSelect:'true',
				fitColumns:'true',
				onLoadSuccess:function(data){
					$(this).datagrid('doCellTip',{'max-width':'300px','delay':500});
				},
				queryParams:{
				logintime1:$('#logintime1').val(),
				logintime2:$('#logintime2').val()
				},
				//idField:'uname',
				columns:[
				  [	
				  	{title:'警号',field:'userid',width:40,sortable:true,align:'left',fixed:true},
				  	{field:'uname',title:'用户名称',align:'left',width:70,fixed:true},
				  	{field:'deptname',title:'用户部门',width:170,align:'left'},
			      	{field:'logintime',title:'访问时间',align:'left',width:110,
			      		//时间格式化
			      		formatter:function(value,rec,index)
			      		{	
			      			var tempDate=new Date(value);
			      			return tempDate.toLocaleString();
			      		}
			      	},
		      		{field:'loginip',title:'用户IP',width:80,align:'center'}
				]],
				pagination:true,
				rownumbers:true
			});
			var p = $('#test').datagrid('getPager');
			$(p).pagination({
				onBeforeRefresh:function(){
				}
			});
			
		});
	</script>
</head>
<body style="margin:0 auto;">
		<div>
		<div>
			<form id="query_form" method="post"   >
				<table width="100%" border="0" cellspacing="0" cellpadding="4" style="background:#e9f8ff; border:1px solid #cbd9e4; font-size:14px;">
				 <tr>
					<td class="td_label">警号</td>
			    		<td class="td_text02"><input type="text" class="input1" id="userid" name="userid" style="width:120px;" value="" maxlength="8" onblur="this.value=this.value.replace(/[^\w\b\u4e00-\u9fa5]/g,'');"/></td>
			    		<td class="td_label"   >姓名</td>
			    		<td class="td_text02" ><input type="text" class="input1" id="uname" name="uname" style="width:120px;" value="" maxlength="15" onblur="this.value=this.value.replace(/[^\w\b\u4e00-\u9fa5]/g,'');"/></td>
			    		<td class="td_label" >时间</td>
			    		<td  class="td_text02" style="width:240px">
			    		<input type="text" id="logintime1" name="logintime1" style="width:100px;cursor: pointer;" readonly="readonly" value="${nowDate}" class="Wdate"  onclick="WdatePicker();"/>
			    		至
		    		<input type="text" id="logintime2" name="logintime2" style="width:100px;cursor: pointer;" readonly="readonly"   value="${nowDate}" class="Wdate"  onclick="WdatePicker();"/>
			    		</td>
			    		<td class="td_label">
							<a onclick="javascript:_goto();">查询</a>
			    		</td>
			    		<td>&nbsp;</td>
				 </tr>
				</table>
			</form>
		</div>
		<table id="test"></table>
	   	<div style="clear:both;"></div>
    </div>
</body>
</html>